<?php
namespace app\index\model;
use think\Model;
use think\Db;
class Push extends Model
{
    protected $resultSetType = 'collection';
    /**
     * [查询商品并计算销量]
     */
    public function AllData($arr=1)
    {
        if($arr==1)
            $res=$this->select();
        else
            $res=$this->where($arr)->find();
        return $res;
    }
    public function pushwater(){
        $show = Db::name('pushwater as p')
            ->join('indent i','p.indentid=i.id','left')
            ->join('agency a','i.agencyid=a.id','left')
            ->join('user m','p.manageid=m.id')
            ->join('admin ad','p.adminid=ad.id')
            ->field('p.*,i.dnumber,i.uptimes,i.reality,a.name as agencyname,m.name as managename,ad.account as adminname')
            ->select();
        return $show;
    }
}
